package com.example.demo.controller;

import com.example.demo.bean.pmsProduct.PmsProductImage;
import com.example.demo.bean.pmsProduct.PmsProductInfo;
import com.example.demo.service.PmsProductInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@Controller
@Api(value="psm列表" )
@CrossOrigin
@RequestMapping("/pms")
public class PmsProductInfoController  {
    @Autowired
    PmsProductInfoService pmsProductInfoService;
    @GetMapping("/{catalog3Id}")
    @ResponseBody
    @ApiOperation(value = "获取pms列表")
    public List<PmsProductInfo> getList(@PathVariable String catalog3Id) {
        return pmsProductInfoService.getAll(catalog3Id);
    }
    @GetMapping("/pmsInfo/{pmsId}")
    @ResponseBody
    @ApiOperation(value = "根据pmsId获取具体的Pms信息")
    public PmsProductInfo getPmsProductImage(@PathVariable String pmsId){
        return pmsProductInfoService.getPmsProductInfo(pmsId);
    }
    @GetMapping("/pmsImages/{pmsId}")
    @ResponseBody
    @ApiOperation(value = "根据pmsId获取Pms图片")
    public List<PmsProductImage> getPmsProductImages(@PathVariable String pmsId) {
        return pmsProductInfoService.getPmsProductImage(pmsId);
    }
}
